Repository navigation
docs: pass an options object to generate() in the T5 and Donut examples - #1961
Open
sarankumar1325 wants to merge 1 commit into
Open
sarankumar1325 wants to merge 1 commit into
sarankumar1325 wants to merge 1 commit into
Conversation
Signed-off-by: sarankumar1325 <120080287+sarankumar1325@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three JSDoc examples call
model.generate()with a tensor as the first argument.generate()takes a single options object (generate({ inputs, ...kwargs })), so these examples fail at runtime:@huggingface/transformers4.3.2 (Node)AutoModelForSeq2SeqLM(models/auto/modeling_auto.js)model.generate(input_ids)Missing the following inputs: input_ids, attention_mask.donut_swin)model.generate(image_inputs.pixel_values, {...})Missing the following inputs: pixel_values.donut_swin)Change
The examples now spread the processor/tokenizer outputs into the options object, which is how the other examples in the repo call
generate:I spread the whole tokenizer output for T5 because the encoder also needs
attention_mask. Passing only{ input_ids }still fails withMissing the following inputs: attention_mask.Verification
I ran the fixed examples in Node with 4.3.2 (
dtype: 'q8'):Ich liebe Transformatoren!, which matches the documented output.<s_docvqa><s_question> What is the invoice number?</s_question><s_answer> us-001</s_answer></s>, which matches the documented output.The CORD-v2 Donut example uses the same call. Prettier passes on both files.